<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.cms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>
<%
	
	Sysop sysop=(Sysop)session.getAttribute("sysop");
	if ( sysop==null)
	{
		dbi.closeAll();
		return;
	}
		
	Integer userId,roleId,categoryId;
	Integer roleCateNum;
	String tmpStr;
	
		roleCateNum=new Integer(request.getParameter("roleCateNum"));
		out.println("roleCateNum="+roleCateNum+"<br>");
		
		for (int i=0;i<roleCateNum.intValue();i++)
		{
			
			if (request.getParameter("checkbox"+i)!=null)
			{
				tmpStr=request.getParameter("checkbox"+i);
				try
				{	
					out.println(tmpStr+"<br>");
					String a=tmpStr.substring(0,tmpStr.indexOf("-"));
					userId=new Integer(a);
					
					tmpStr=tmpStr.substring(tmpStr.indexOf("-")+1,tmpStr.length());
					a=tmpStr.substring(0,tmpStr.indexOf("-"));
					roleId=new Integer(a);
					
					a=tmpStr.substring(tmpStr.lastIndexOf("-")+1,tmpStr.length());
					categoryId=new Integer(a);
					
				}catch(Exception e)
				{
					out.println(e);
					return;
				}
				
				String sql="delete from sysop_role where userid="+userId+" and roleid="+roleId;
				sql+=" and categoryid="+categoryId;
				out.println(sql+"<br>");
				
				SysRole.deleteRoleCategory(dbi,sql);
				
			}
		}
%>
<%@ include file="../init_free.jsp" %>	
<%
		response.sendRedirect("roleCommission.jsp?userid="+request.getParameter("userid"));
%>	
